{include file="headerLogin.tpl.html"}

<div id="divContent" class="widthContent2 radiusDiv shadowDiv backWhite textAlignLeft tableDiv" style="height:auto; margin-top:50px;">
	<div class="cellTableDiv leftDivFloat widthContent2 leftTopRadiusDiv rightTopRadiusDiv darkBlueEffect" style="text-align:center;">
		<p class="pCellDivHead">Login</p>
	</div>	 
	<div class=" cellTableDiv leftDivFloat widthContent2 lightGreyDiv3" style="height: 200px; text-align:center;">
		
		
		<table class="widthContent2" style="">
			<tr>
				<td colspan="2">&nbsp;</td>
			</tr>
			<tr>
				<td colspan="2">&nbsp;</td>
			</tr>
			<tr>
				<td width="40%" style="padding-left:30px;">Username</td>
				<td align="left"><input type="text" id="user" name="user" class="inputGeneric200" value="{$user}" /></td>
			</tr>
			<tr>
				<td style="padding-left:30px;">Password</td>
				<td align="left"><input type="password" name="password" class="inputGeneric200" value="" /></td>
			</tr>
			<tr>
				<td colspan="2">&nbsp;</td>
			</tr>
			<tr>
				<td colspan="2">&nbsp;</td>
			</tr>
			<tr valign="middle" style="">
				<td colspan="2" align="center">&nbsp;{$error}</td>
			</tr>
			<tr>
				<td colspan="2">&nbsp;</td>
			</tr>
			<!--<tr>
				<td colspan="2" align="center">Se vuoi registrarti premi <b><a href="#" onclick="editItem()">QUI</a></b></td>
			</tr>-->
			<tr>
				<td  colspan="2" style="">
					<input type="button" class="buttonNew2 shadowButton effectImage radiusButton" onClick="_submit()" value="Login" />
				</td>
			</tr>
		</table>
	
	</div>
	<div class="cellTableDiv leftDivFloat widthContent2 leftBottomRadiusDiv rightBottomRadiusDiv darkBlueEffect" style="height: 10px;text-align:center;">
	</div>	
</div>

<input type="hidden" name="recupero" id="recupero" value="{$recupero}" />
<input type="hidden" name="azienda" value="{$azienda}" />
<input type="hidden" name="save" value="{$save}" />

{include file="funcPopup.js"}

<script type="text/javascript">
	{if $returnPath != '' && $endSession == 'S' }
		document.location.href = '{$returnPath}';
	{/if}
	setFocus();
	var azienda = '{$azienda}';
	var parentDoc = '{$parent}';
	
{literal}
	if ( document.getElementById("recupero").value == 'S')	
	{
		document.getElementById("divRecupero").style.display = "block";
		document.getElementById("divLogin").style.display = "none";
	}

	function _submitRec()
	{
		if ( document.getElementById("user2").value != "")
		{	
			document.main.recupero.value = "S";
			document.main.submit();
		}
		else
		{
			alert("Username mancante")
		}
	}

	function _submitRegister()
	{
// 		document.main.save.value = "R";
// 		document.main.submit();
				document.location.href = "Main.php?mod=utente&do=register";
	}

	function _submitLog()
	{
		document.location.href = "Main.php?"
	}

	
	function recuperaPass()
	{
		document.getElementById("divRecupero").style.display = "block";
		document.getElementById("divLogin").style.display = "none";
		document.main.user2.focus();
	}
	
	function editUser( tipo )
	{
		if ( tipo == "utente" )
		{
			document.getElementById("user").value = "";
			document.getElementById("user").readOnly = false;
			setFocus();
		}
		else
		{
			document.getElementById("user").value = "admin";
			document.getElementById("user").readOnly = true;
		}
		document.getElementById("password").value = "";
	}
	
	function _submit()
	{
		//if ( parentDoc != '' )
		//	parent.callApp( document.main.user.value, document.main.pass.value );
		//else
		//alert ('ok');
			document.main.submit();
	}
	
	function responseKeyPress(key)
	{
		if ( key == "ENTER" ) _submit();
	}

    function setFocus() 
    {
        document.main.user.focus();
    }

    function setUser( usr ) 
    {
        document.getElementById("user").value = usr;
    }
	
	function editItem()
	{
		popupOpenId('registra','registra', '&azienda='+azienda);
	}
{/literal}
</script>

{include file="sysMsg.js"}
{include file="sysError.tpl.html"}
{include file="usrError.tpl.html"}
{include file="usrInfo.tpl.html"}
{include file="footerLogin.tpl.html"} 
